package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.UserTransferMapper;
import com.ly.heart.service.IUserTransferService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.UserTransferEntity;

import javax.annotation.Resource;

/**
 * 人员调动申请记录Service业务层处理
 * @author wutao
 * @date 2024-05-31
 */
@Service
public class UserTransferServiceImpl extends ServiceImpl<UserTransferMapper, UserTransferEntity> implements IUserTransferService {

    @Resource
    private UserTransferMapper userTransferEntityMapper;

    /**
     * 查询人员调动申请记录
     * @param id 人员调动申请记录ID
     * @return 人员调动申请记录
     */
    @Override
    public UserTransferEntity selectUserTransferEntityById (String id) {
        return userTransferEntityMapper.selectUserTransferEntityById ( id );
    }

    /**
     * 查询人员调动申请记录列表
     * @param userTransferEntity 人员调动申请记录
     * @return 人员调动申请记录
     */
    @Override
    public List<UserTransferEntity> selectUserTransferEntityList (UserTransferEntity userTransferEntity) {
        return userTransferEntityMapper.selectUserTransferEntityList ( userTransferEntity );
    }

    /**
     * 新增人员调动申请记录
     * @param userTransferEntity 人员调动申请记录
     * @return 结果
     */
    @Override
    public int insertUserTransferEntity (UserTransferEntity userTransferEntity) {
        userTransferEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        userTransferEntity.setCreateTime ( DateUtils.getNowDate () );
        return userTransferEntityMapper.insertUserTransferEntity ( userTransferEntity );
    }

    /**
     * 修改人员调动申请记录
     * @param userTransferEntity 人员调动申请记录
     * @return 结果
     */
    @Override
    public int updateUserTransferEntity (UserTransferEntity userTransferEntity) {
        userTransferEntity.setUpdateTime ( DateUtils.getNowDate () );
        return userTransferEntityMapper.updateUserTransferEntity ( userTransferEntity );
    }

    /**
     * 批量删除人员调动申请记录
     * @param ids 需要删除的人员调动申请记录ID
     * @return 结果
     */
    @Override
    public int deleteUserTransferEntityByIds (String[] ids) {
        return userTransferEntityMapper.deleteUserTransferEntityByIds ( ids );
    }

    /**
     * 删除人员调动申请记录信息
     * @param id 人员调动申请记录ID
     * @return 结果
     */
    @Override
    public int deleteUserTransferEntityById (String id) {
        return userTransferEntityMapper.deleteUserTransferEntityById ( id );
    }
}
